import axios from 'axios'

export default {
  async getUser () {
    let result = await axios({
      url: '/api/admin/getUser',
      method: 'get'
    })
    return result
  },
  async addUser (name, type, password, storeId, serviceId, warehouseId) {
    let result = await axios({
      url: '/api/admin/addUser',
      method: 'post',
      data: {
        name: name,
        type: type,
        password: password,
        storeId: storeId,
        serviceId: serviceId,
        warehouseId: warehouseId
      }
    })
    return result
  },
  async getWarehouse () {
    let result = await axios({
      url: '/api/admin/getWarehouse',
      method: 'get'
    })
    return result
  },
  async addWarehouse (address) {
    let result = await axios({
      url: '/api/admin/addWarehouse',
      method: 'post',
      data: {
        address: address
      }
    })
    return result
  },
  async getStore () {
    let result = await axios({
      url: '/api/admin/getStore',
      method: 'get'
    })
    return result
  },
  async addStore (name, address, leader) {
    let result = await axios({
      url: '/api/admin/addStore',
      method: 'post',
      data: {
        name: name,
        address: address,
        leader: leader
      }
    })
    return result
  },
  async getFactory () {
    let result = await axios({
      url: '/api/admin/getFactory',
      method: 'get'
    })
    return result
  },
  async addFactory (name, address, email, phone, leader, mainCamp) {
    let result = await axios({
      url: '/api/admin/addFactory',
      method: 'post',
      data: {
        name: name,
        address: address,
        email: email,
        phone: phone,
        leader: leader,
        mainCamp: mainCamp
      }
    })
    return result
  },
  async getCustormerService () {
    let result = await axios({
      url: '/api/admin/getCustormerService',
      method: 'get'
    })
    return result
  },
  async addCustormerService (name, address, phone, storeId) {
    let result = await axios({
      url: '/api/admin/addCustormerService',
      method: 'post',
      data: {
        name: name,
        address: address,
        phone: phone,
        storeId: storeId
      }
    })
    return result
  }
}
